<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="">
    <meta http-equiv="x-dns-prefetch-control" content="on">

    <title>嘉定计量质量检测公共服务平台</title>
    <link href="css/css.css" rel="stylesheet" type="text/css"><!--全局-->
    <link href="css/jiliang.css" rel="stylesheet" type="text/css"><!--指定-->
    <script  src="common/js/jquery-easyui-1.2.5/jquery-1.7.1.min.js">  //引入jq
	</script> 
	<script type="text/javascript" src="common/js/json2.js"></script>
	<script type="text/javascript" src="common/js/jquery.min.js"></script>
	<script  src="common/js/init.js"> </script> 
	<script  src="common/js/basefast.js"> </script> 
      <script type="text/javascript"> 
  	$(document).ready( function()
  		{  
  		var id = getQueryString("id"); 
  		if(id==null||id=="")
  		{
  			alert("您还未登录!请登录!");
  			window.location="index.html";
  		} 
  		function getQueryString(name) {//取URL参数  要得到id 就传id
		    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
		    var r = window.location.search.substr(1).match(reg);
		    if (r != null) return unescape(r[2]); return null;
		    }	 
  		 
  		$("#btn").bind("click",function(){
  			 if($("#old_pwd").val().trim()==""||$("#new_pwd1").val().trim()==""||$("#new_pwd2").val().trim()=="")
  				 {
  				 alert("请输入有效的密码!(不能包含空格)");
  				 return;
  				 }
  			if($("#new_pwd1").val().trim()!=$("#new_pwd2").val().trim())
				 {
				 alert("新密码输入不一致!(不能包含空格)");
				 return;
				 } 
  			var gz = /^[0-9._-]{6,12}$/;
			 if(!gz.test($("#new_pwd1").val().trim())||!gz.test($("#new_pwd2").val().trim()))
				{
						alert("请输入6-12位的新密码");
						return;
				}
  			var info = {};
			info.sForm = { 
									"pwd":$("#old_pwd").val(), 
									"new_pwd2":$("#new_pwd2").val(),
									"token":id
									};
			Communicator.send("LoginService", "updpwd", info, {
				onSuccess : function(data){
					if(data.msg=="nofindid")
					{
							alert("别人使用您的账号进行了登陆,请重新登录");
							window.location="index.html";
					}else if(data.msg=="1")
					{
							alert("修改密码成功!");
					}else if(data.msg=="-1")
					{
							alert("您输入的密码错误!");
					}else{
							alert("您输入的密码错误!");	
					}
				},onFail:function(xmlR, status, e) { 
				 
				}
			});
  			
  		});//点击事件结尾
  		
  }); 
      </script> 
    
</head>
<body class="bg_img">
<section class="loginarea mt77">
    <div class="itemgroup">
        <div class="inputarea">
            <span class="inputnamebig">原密码</span>
            <span class="inputformbig"> 
                <input class="formstyle w80" type="password" placeholder="请输入原密码" id="old_pwd"/>
               <font color="red" style="display: none; " id="font"></font> 
            </span>
        </div>
        <div class="inputarea">
            <span class="inputnamebig">新密码</span>
            <span class="inputformbig"> 
                <input class="formstyle w100" type="password" placeholder="请输入新密码" id="new_pwd1"/>
            </span>
        </div>
        <div class="inputarea">
            <span class="inputnamebig">确认新密码</span>
            <span class="inputformbig"> 
                <input class="formstyle w100" type="password" placeholder="确认新密码" id="new_pwd2"/>
            </span>
        </div>
    </div>
    <button class="btn bottomone2btn mt38 left" id="btn">确定</button>
    <button class="btn bottomone2btn mt38 right" onClick="javascript :history.go(-1);" >返回</button> 
</section>
</body>
</html>